@import 'common.less';

.width-initial {
  width: auto !important;
  width: initial !important;
}

.width-limit {
  max-width: 600px;
}

textarea.width-limit {
  max-width: 80%;
}

.width-limit-lg {
  max-width: 800px;
}

.width-limit-xl {
  max-width: 1000px;
}

.inline-form-control {
  display: inline-block;
  margin-right: 20px;
  margin-left: 20px;
  min-width: 50%;
  width: 50% !important;
  width: initial !important;
}

.no-min-width {
  min-width: 0 !important;
}

.align-initial {
  text-align: left;
  text-align: initial;
}

.opacity-half {
  opacity: .5 !important;
}

.opacity-0 {
  opacity: 0 !important;
}

ul.list-style-none, li.list-style-none {
  list-style: none;
  padding-left: 0;
}

.help-inline {
  margin-left: 10px;
  color: #595959;
}

.settings-group {
  > * {
    margin-left: 30px;
  }
  > h3 {
    margin-left: 0;
  }
}

/* shepherd.js */

.shepherd-element {
  z-index: 20;
}

.shepherd-active {
  &:before {
    content: " ";
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, .5);
    z-index: 10;
  }

  .switch-rules {
    position: relative;
    background-color: #7f7f7f;
    z-index: 11;

    &, th, td, tbody {
      border-color: #6e6e6e !important;
    }

    .btn {
      opacity: .5;
    }

    .form-control, .btn-default {
      background-color: #7f7f7f;
      border-color: #6e6e6e;
      opacity: 1;
    }

    .shepherd-enabled {
      background-color: #fff;
      border-color: #ddd !important;
      &, td, tbody {
        border-color: #ddd !important;
      }

      .btn {
        opacity: 1;
      }

      .form-control, .btn-default {
        background-color: #fff;
        border-color: #ddd;
      }
    }

  }

  .condition-help-section {
    position: relative;
    z-index: 11;
    background-color: #fff;
  }

  &:not([data-shepherd-step="fixed-servers-step"]) {
    .side-nav {
      position: absolute;
      overflow: visible;
      bottom: 0;
    }

    .shepherd-enabled > a {
      color: #428bca;
      background-color: #fff;
    }
  }

  &[data-shepherd-step="switch-default-step"] {
    .sort-bar {
      position: relative;
      z-index: 11;
      background-color: #ffc;
    }
  }
}

.shepherd-enabled {
  position: relative;
  z-index: 11;

  &.fixed-servers {
    background-color: #fff;
  }
}

.fixed-top-right {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
}

/* alert */

.alert-top-wrapper {
  z-index: 100;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  display: inline-block !important;

  transition: transform .5s, opacity .5s;
  transition: transform cubic-bezier(0.19, 1, 0.22, 1) .5s,
              opacity cubic-bezier(0.19, 1, 0.22, 1) .5s;

  &.ng-hide {
    transform: translateY(-100%);
    opacity: 0;
  }

  pointer-events: none;
  text-align: center;

  * {
    pointer-events: auto;
    pointer-events: initial;
    .align-initial();
  }

  .alert {
    display: inline-block;
    min-width: 400px;
    margin-bottom: 0;

    @media (max-width: 767px) {
      min-width: 80%;
    }
  }
}

/* body */

html {
  height: 100%;
}

body {
  min-height: 100%;
}

.modal-backdrop {
  position: fixed;
  bottom: 0;
}

h1 {
  color: #5c6166;
  font-size: 1.7em;
  font-weight: bold;
  margin-bottom: 1.5em;
}

.side-nav {
  position: fixed;
  height: 100%;
  overflow: auto;

  @media (max-width: 767px) {
    position: static;
    height: auto;
    height: initial;
  }

  .nav-pills {
    > li > a {
      padding: 8px 15px;
      @media (max-height: 767px) {
        padding: 5px 15px;
      }

      &.btn-success:hover {
        // Fix hover style of [Apply changes] when highlighted.
        color: #fff;
        background-color: #449d44;
        border-color: #398439;
      }
    }
  }
}

main {
  padding-top: 85px;
  padding-bottom: 20px;

  .page-header {
    margin: 0;
    padding: 20px 60px 20px 0;
    position: fixed;
    top: 0;
    width: inherit;
    background-color: rgba(255, 255, 255, 0.6);
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.6));
    max-height: 85px;
    z-index: 3;

    h2 {
      margin: 0;
    }
  }

  @media (max-width: 767px) {
    padding-top: 0;
    .page-header {
      position: static;
      max-height: none;
    }
  }

  .ng-enter {
    opacity: 0;
    transition: opacity .5s;
  }

  .ng-enter-active {
    opacity: 1;
  }
}

#ngProgress-container {
  position: fixed;
  top: 0;
  width: 100%;
}

.divider {
  height: 1px;
  margin: 9px 1px;
  overflow: hidden;
  background-color: #e5e5e5;
}

.nav-header {
  margin-right: -15px !important;
  margin-left: -15px !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
  display: block;
  padding: 3px 15px;
  font-size: 11px;
  font-weight: bold;
  line-height: 20px;
  color: #999;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
  text-transform: uppercase;
}

#restore-local-file {
  position: absolute;
  visibility: hidden;
}

.virtual-profile-icon {
  border: dotted 1px;
  margin: -1px;
}

.profile-actions {
  float: right;
}

.profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-color-editor {
  display: inline-block;
  float: left;
  margin-right: 10px;

  input[type="color"] {
    height: 30px;
    width: 30px;
    padding: 0;
    border: none;
    background: none;

    &::-webkit-color-swatch-wrapper {
      padding: 0;
    }
  }

  .sp-replacer {
    padding: 0;
    border: none;
  }

  .sp-preview, .profile-color-editor-fake {
    margin-right: 0;
    height: 30px;
    width: 30px;
    border: solid 1px #222;
  }

  .sp-dd {
    display: none;
  }
}

@media (min-width: 768px) {
  // Try to workaround the issue where dropdown menus in the table are clipped.
  // .table-responsive sets overflow-x, which causes the issue. Just setting
  // overflow-y: visible will NOT work. Scrolling must be disabled for X & Y.
  // See: http://stackoverflow.com/a/6433475
  .table-responsive {
    overflow: visible;
  }
}

@media (max-width: 767px) {
  // Try to make sure that the dropdown fits in the table-responsive scroll box.
  // It effectively inlines the whole dropdown menu. Ugly, but at least working.
  .table-responsive .dropdown-menu {
    position: static !important;
  }
}

.fixed-servers,
.switch-rules {
  td {
    vertical-align: middle !important;
  }
}

.condition-help {
  dl {
    margin-left: 5px;
    padding-left: 10px;
    border-left: solid 1px #ccc;
  }
  dt {
    font-size: 1.2em;
  }
  dd {
    padding-left: 20px;
  }
}

.close-condition-help {
  float: none !important;
  margin-left: 15px !important;
  opacity: 1 !important;

  &:hover, &:active {
    color: #444 !important;
  }
}

.switch-attached {
  > tr > td {
    background-color: #f9f9f9;

    .shepherd-active & {
      background-color: transparent;
    }

    &:first-child {
      text-align: center;
    }
  }
}

.fixed-show-advanced {
  td {
    background-color: transparent !important;
  }
  .btn-link {
    padding: 0;
  }
}

.proxy-actions {
  text-align: center;
  padding: 0 !important;
}

.proxy-auth-toggle {
  padding: 5px 7px !important;
}

.host-levels-details {
  input {
    .width-initial();
    display: inline-block;
  }
}

.sort-bar {
  width: 1em;
  text-align: center;
  cursor: move;
}

.switch-rule-row td.has-icon {
  > .form-control {
    display: inline-block;
    width: ~"calc(100% - 1.5em)";
  }

  > .icon-wrapper {
    display: block;
    float: right;
    line-height: 34px;
  }
}

.cycle-profile-container {
  list-style-type: none;
  min-height: 20px;
  display: inline-block;
  min-width: 40%;
  padding: 0;
  border: solid 1px #abc;

  li {
    display: block;
    margin: 10px;
    padding: 5px;
    cursor: move;
    background-color: #ddd;

  }

  &.cycle-enabled li {
    background-color: #e4ffcd;
  }
}

.modal-body .well:last-child {
  margin-bottom: 0;
}
